Sprite {
	var <>images;
	var <lastX;
	var <lastY;
	var <x;
	var <y;
	var <>width;
	var <>height;
	var <>scale;
	var <>rotate;
	var <>type;
	var <>enterAction;
	var <>leaveAction;
	var <>symbol;
	*new { | images, x=0, y=0, width=20, height=20, scale=nil, rotate=nil,
		type = nil, enter, leave, symbol |
		^super.new.init( images, x, y, width, height, scale, rotate, type,
			enter, leave, symbol );
	}
	init { | imgs, x_pos, y_pos, w, h, scl, rot, typ, enter, leave, sym |
		images = imgs;
		x = ( lastX = x_pos );
		y = ( lastY = y_pos );
		scale = scl;
		rotate = rot;
		width = w;
		height = h;
		type = typ;
		symbol = sym;
		enterAction = enter ? {{}};
		leaveAction = leave ? {{}};
	}
	img { | idx = 0 |
		^images@@idx;
	}
	overlap { | other, increment |
		^[
			{ ( this.interpolateX( increment ) + this.width ) >
				other.interpolateX( increment ) },
			{ this.interpolateX( increment ) <
				( other.interpolateX( increment ) + other.width ) },
			{ ( this.interpolateY( increment ) + this.height ) >
				other.interpolateY( increment ) },
			{ this.interpolateY( increment ) <
				( other.interpolateY( increment ) + other.height ) }
		].detect( not( _.() ) )
		.isNil
	}
	enter { | spr |
		enterAction.value( spr );
	}
	leave { | spr |
		leaveAction.value( spr );
	}
	x_ { | v |
		lastX = x;
		x = v;
	}
	y_ { | v |
		lastY = y;
		y = v;
	}
	interpolateX { | n |
		^( ( x - lastX ) * n ) + lastX;
	}
	interpolateY { | n |
		^( ( y - lastY ) * n ) + lastY;
	}
}
